home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 526-550 / disk_550 / icalc / icalc.init < prev    next >
Text File  |  1992-05-06  |  1KB  |  43 lines

  1. #
  2. #    icalc.init
  3. #
  4. #    Default startup file for icalc, containing definitions for many
  5. #    useful functions.
  6. #
  7. #    Martin W Scott, August 1991
  8. #
  9.  
  10. silent        # switch off confirmation of definitions
  11.  
  12. func deg(z) = DEG*z        # convert radians to degrees
  13. func rad(z) = z/DEG        # and degrees to radians
  14. func log(z) = ln(z)/LOG10    # base-10 logarithm
  15. func lg(z) = ln(z)/LOG2        # base-2 logarithm
  16.  
  17. # inverse hyperbolic trig functions
  18. func asinh(z) = ln(z+sqrt(sqr(z)+1))
  19. func acosh(z) = ln(z+sqrt(sqr(z)-1))
  20. func atanh(z) = 0.5*ln((1+z)/(1-z))
  21.  
  22. # gamma(z+1)...very accurate
  23. # NB: gamma(0) undefined
  24. func gamma(z) = sqrt(2*PI*z)*z^z*exp(-z)*(1+(1+(1-139/(180*z))/(24*z))/(12*z))
  25.  
  26. # combinatorics
  27. func fact(n) = Prod(_n=1,n,_n)
  28. func perm(n,r) = Prod(_n=n-r+1,n,_n)
  29. func comb(n,r) = perm(n,r)/fact(r)
  30.  
  31. # miscellaneous
  32.  
  33. # round real & imag parts
  34. func round(z,places) = int(z*10^places)/10^places
  35.  
  36. # create complex number from modulus and argument
  37. func polar(r,theta) = exp(i*r*theta)
  38.  
  39. # create complex number from real and imaginary parts
  40. func complex(real,imag) = real + i*imag
  41.  
  42. verbose        # restore display of results, messages
  43.